﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using DeepEarth;

namespace DeepMap
{
	public class ReverseGeocode
	{
		Map _Map;
		
		public ReverseGeocode(Map map)
		{
			_Map = map;
            map.Events.MapMouseDown += this.MouseDown;
		}
		
		public void MouseDown(Map map, MouseButtonEventArgs args)
        {
            if (Keyboard.Modifiers == ModifierKeys.Alt)
            {
                args.Handled = true;

                Point location = map.CoordHelper.PixelToGeo(args.GetPosition(map));
//                GeocodeService.Find(location, (o, ev) =>
//                                                  {
//                                                      List<GeocodeResult> results = ((GeocodeResultArgs) ev).Results;
//                                                      if (results.Count > 0)
//                                                      {
//                                                          MessageBox.Show(results[0].DisplayName);
//                                                      }
//                                                  });
            }
        }
	}
}